Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JENKINS-72224 Prevent deadlock when onConfigurationChange() is called frequently #1391

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

jonesbusy
Copy link
Contributor

@jonesbusy jonesbusy commented Jul 12, 2024

JENKINS-72224 Prevent deadlock during frequent calls to onConfigurationChange()

Unexpected deadlock added on

I was missing that the onConfigurationChange was also calling the refreshModel. It caused deadlock on busy instance with many nodes.

This PR restores the original code from refreshModel that just probe for label.

The saveNodeLabel it's now just called on the preOnline phase just after labels are collected.

The use case is really for ephemeral agent that connect frequently and to ensure those labels sees the new node.

I think there is a almost no chance that platform labels changes when a node is modified or when an other node connect. According to https://javadoc.jenkins.io/hudson/slaves/ComputerListener.html#onConfigurationChange() it's called every time a node is added or removed

Checklist

  • I have read the CONTRIBUTING doc
  • I have referenced the Jira issue related to my changes in one or more commit messages
  • Unit tests pass locally with my changes
  • No spotbugs warnings were introduced with my changes
  • I have interactively tested my changes

Types of changes

What types of changes does your code introduce?

  • Bug fix (non-breaking change which fixes an issue)

@jonesbusy jonesbusy requested a review from a team as a code owner July 12, 2024 13:02
@jonesbusy
Copy link
Contributor Author

FYI @MarkEWaite

I've just also tested the incrementals on my production instance. I cannot reproduce the deadlock.

platform_labeler1
platform_labeler2

Regards

@MarkEWaite MarkEWaite added the bug Incorrect or flawed behavior label Jul 12, 2024
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Works great in my testing as well.

@MarkEWaite MarkEWaite merged commit 5444054 into jenkinsci:master Jul 12, 2024
17 checks passed
@jonesbusy jonesbusy deleted the bugfix/deadlock branch July 15, 2024 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect or flawed behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants